package com.itheima.collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.function.Predicate;

/*
Collection
的removeIf()

 */
public class Demo01 {


    public static void main(String[] args) {
        Collection<String> list= new ArrayList<>();
        list.add("蔡徐坤");
        list.add("蔡徐坤");
        list.add("黄子韬");
        list.add("鹿晗");
        System.out.println(list);
        //匿名内部类
      /*  list.removeIf(new Predicate<String>() {
            @Override
            public boolean test(String s) {
                return s.length()==3;
            }
        });*/
      list.removeIf(s-> s.charAt(0)=='蔡');
        System.out.println(list);
        list.removeIf(new Predicate<String>() {
            @Override
            public boolean test(String s) {
                return false;
            }
        });

    }
}
